We consider anisotropic Kantowski–Sachs cosmology in Weyl integrable spacetime with an ideal gas. We perform a detailed analysis of the dynamics by investigating the stationary points and reconstruct the cosmological history. This analysis gives important information for the initial value problem in Weyl integrable spacetime. We study three cases, in which the scalar field mass depends only on the density of the ideal gas, with or without cosmological constant term, and when there exists an exponential scalar field potential. We conclude that the existence of the nonzero potential function is essential in order that a spatially flat FLRW universe which can describe inflation can be a future attractor.